/**
 * 以前函数写法
 */
// function Person(name) {
//     this.name = name
// }

// Person.prototype.say = function(){
//     console.log('hello')
// }

/**
 * es6:class类 ,new
 */
class Person {
    constructor(name) {
        this.name = name
    }
    say() {
        console.log(`hi,my name is ${this.name}`)
    }
}
let p = new Person('tom')
p.say()